package com.speedricemanager.activity.home.registeframent;

import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.speedricemanager.R;
import com.speedricemanager.activity.home.registeframent.presenter.RegisterauditFramentPersenterac;
import com.speedricemanager.activity.home.registeframent.view.RegisterauditFrament_Inter;
import com.speedricemanager.other.base.BaseAty;
import com.speedricemanager.other.utils.PickerViewTime;
import com.vondear.rxtools.view.RxTitle;
import com.wuxiaolong.pullloadmorerecyclerview.PullLoadMoreRecyclerView;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;

/**
 * Created by 李征 on 2017/12/18.
 */

public class RegisterSeek extends BaseAty implements RegisterauditFrament_Inter {
    @InjectView(R.id.dianfupullLoadMoreRecyclerView)
    PullLoadMoreRecyclerView dianfupullLoadMoreRecyclerView;
    RegisterauditFramentPersenterac registerauditFramentPersenter;
    @InjectView(R.id.editousuo)
    EditText editousuo;
    @InjectView(R.id.imagesousuo)
    ImageView imagesousuo;
    @InjectView(R.id.startime)
    TextView startime;
    @InjectView(R.id.enttime)
    TextView enttime;
    @InjectView(R.id.rx_title)
    RxTitle rxTitle;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.registerseek);
        ButterKnife.inject(this);
        setTitle(rxTitle);
        dianfupullLoadMoreRecyclerView.setLinearLayout();
        dianfupullLoadMoreRecyclerView.setPushRefreshEnable(false);
        dianfupullLoadMoreRecyclerView().setPullRefreshEnable(false);
        registerauditFramentPersenter = new RegisterauditFramentPersenterac(this, this);
    }


    @Override
    public String getstatic() {
        return "";
    }

    @Override
    public int getTags() {
        return 4;
    }

    @Override
    public PullLoadMoreRecyclerView dianfupullLoadMoreRecyclerView() {
        return dianfupullLoadMoreRecyclerView;
    }

    @Override
    public EditText editousuo() {
        return editousuo;
    }

    @Override
    public TextView startime() {
        return startime;
    }

    @Override
    public TextView enttime() {
        return enttime;
    }

    @OnClick({R.id.imagesousuo, R.id.startime, R.id.enttime})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.imagesousuo:
                if (editousuo.getText().toString().equals("")){
                    errorAlert("搜索条件不能为空");
                    return;
                }
                registerauditFramentPersenter.seekList();
                break;
            case R.id.startime:
                PickerViewTime.getTData(this, 0, startime);
                break;
            case R.id.enttime:
                PickerViewTime.getTData(this, 0, enttime);
                break;
        }
    }
}
